package dp.gr03.payroll.schedules;

import java.util.GregorianCalendar;

import dp.gr03.payroll.payrollDomain.PaymentSchedule;

public class WeeklySchedule implements PaymentSchedule
{

    @Override
    public boolean isPayDate(GregorianCalendar date)
    {
        return date.get(GregorianCalendar.DAY_OF_WEEK) == GregorianCalendar.FRIDAY;
    }

    @Override
    public GregorianCalendar getPayPeriodStartDate(GregorianCalendar payDate)
    {
        GregorianCalendar startDate = (GregorianCalendar) payDate.clone();
        startDate.add(GregorianCalendar.DAY_OF_MONTH, -5);
        return startDate;
    }

}
